package com.bm.server.controller;


import com.bm.server.dto.UserLoginDto;
import com.bm.server.service.intf.UserService;
import com.bm.server.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/user/")
@Api(tags = "登陆相关的操作-李松洋")
@CrossOrigin
public class UserController {
    @Resource
    private UserService service;
    @ApiOperation(value = "校验手机号")
    @GetMapping("/check.do")
    public R check(@RequestParam String phone){
        return service.checkPhone(phone);
    }
    @ApiOperation(value = "验证码登录")
    @PostMapping("/logincode.do")
    public R loginCode(@RequestBody UserLoginDto dto){
        return service.phoneLogin(dto);
    }
    @ApiOperation(value = "注销")
    @GetMapping("/loginOut.do")
    public R loginOut(@RequestParam int uid){
        return service.loginOut(uid);
    }
    @ApiOperation(value = "一键登录")
    @GetMapping("/oauth.do")
    public R oauth(@RequestParam String phone){
        return service.oauth(phone);
    }
}
